<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>登录</title>
		<script src="${pageContext.request.contextPath }/js/JQuery.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/js/layui/css/layui.css"/>
	</head>
	<style type="text/css">
		body{margin: auto;font-family: "Microsoft Yahei";background-image: url(${pageContext.request.contextPath }/img/loginbackground.jpg);background-size: 100%,50%;right:300px;}
		a{margin-left: 80px;display: inline-block;font-size: 16px;color: #1E9FFF;width: 90px;margin-top: 10px;}
		.login{width: 400px;height: 400px;border-color: #000000;margin: auto;border-radius: 10px;position: relative;top: 150px;background-color: white;opacity: 0.7;}
		.head{display: block;text-align: center;font-size: 28px;font-weight: bold;padding-top: 30px;}
		.unite{margin-top: 35px;font-size: 20px;margin-left: 50px;}
		.unite div:nth-child(1){display: inline-block;width: 90px;margin-left: 10px;}
		.unite div:nth-child(2){display: inline-block;width: 100px;}
		.unite div:nth-child(3){display: inline-block;width: 90px;}
		.layui-btn-normal{margin: auto;display: block;width: 200px;margin-top: 20px;}
	</style>
	<body>
		<div class="login">
			<div class="login_body">
				<span class="head">社区养老服务信息系统</span>
				<div class="login_yonghumings unite">
					<span class="login_yonghuming">用户名：</span>
					<input type="text" name="" id="account" value="" placeholder="用户名" maxlength="11"/>
				</div>
				<div class="login_mimas unite">
					<span class="login_mima">密&nbsp;&nbsp;&nbsp;码：</span>
					<input type="password" name="" id="password" value="" placeholder="密码" maxlength="20"/>
				</div>
				<div class="unite">
					<div>
						<input type="radio" name="login_type" id="" value="1" />用&nbsp;&nbsp;&nbsp;户
					</div>
					<div>
						<input type="radio" name="login_type" id="" value="2" />服务人员
					</div>
					<div>
						<input type="radio" name="login_type" id="" value="3" />管&nbsp;理&nbsp;员
					</div>
				</div>
				<a href="${pageContext.request.contextPath }/jsp/loggin.jsp">注&nbsp;&nbsp;&nbsp;册</a>
				<a class="bye" href="#">忘记密码</a>
				<button class="layui-btn layui-btn-normal">登录</button>
			</div>
		</div>
	</body>
	<script>
		window.onload=function(){
			$(".bye").click(function(){
				alert('功能暂时不开通！请联系管理员修改密码！！');
			})
			$(".layui-btn").click(function(){
				var account_id=$("#account").val();
				var account_password=$("#password").val();
				var account_type=$("input[type='radio']:checked").val(); 
				var params={
						account_id:account_id,
						account_password:account_password,
						account_type:account_type
				}
				//alert(account_password);
				if(account_type==""||account_type==null){
					alert('请选择登录类型');
				}else{
					$.post("${pageContext.request.contextPath}/consumer/logins",params,function(data){
						if(data == "true"|| data==true){
							if(account_type==1||account_type=='1'){
								window.location="${pageContext.request.contextPath }/jsp/user.jsp";
							}else if(account_type==2||account_type=='2'){
								window.location="${pageContext.request.contextPath }/jsp/servicer.jsp";
							}else if(account_type==3||account_type=='3'){
								window.location="${pageContext.request.contextPath }/jsp/manager.jsp";
							}else{
								alert("登录失败账号还在审核中");
							}
						}else{
							alert("登录失败请重新登录");
						}
					});
				};
			});
		}
	</script>
</html>
